package level;

import flixel.util.FlxPoint;

class EntryPoint extends FlxPoint{
	public var id(default, null): Int ;
    public var facingLeft(default, null): Int;

    public function new(X: Float, Y: Float, Id: Int, IsFacingLeft: Int = 0){
    	super(X, Y);
    	id = Id;
    	facingLeft = IsFacingLeft;
    	_entrypoints.push(this);
    }

    public static function findEntryPoint(Id: Int): EntryPoint
	{
		for( i in 0..._entrypoints.length ) {
        	if(_entrypoints[i].id == Id){
        		return _entrypoints[i];
        	}
    	}
    	throw("Level::findEntryPoint(): No se pudo encontrar el Punto de Entrada con id: \"" + Id + "\"");
	}

	public static function clearAll()
	{
		_entrypoints = [];
	}

	private static var _entrypoints: Array<EntryPoint>;
}